function tapBanner(e) {
  var id = e.currentTarget.dataset.id
  var name = e.currentTarget.dataset.name
  var linktype = e.currentTarget.dataset.linktype
  var url = e.currentTarget.dataset.url
  var mobile = e.currentTarget.dataset.mobile
  if (id != 0) {
    if (linktype == "product") {//产品详情
      wx.navigateTo({
        url: "/pages/goods-details/index?id=" + id,
      })
    }
    else if (linktype == "store_class") {//产品分类
      wx.navigateTo({
        url: "/pages/classesTwo/index?id=" + id + "&&name=" + name,
      })
    }
    else if (linktype == "news") {//新闻详情
      wx.navigateTo({
        url: '/pages/news-details/index?newsid=' + id,
      })
    }
    else if (linktype == "news_type") {//新闻列表
      wx.navigateTo({
        url: '/pages/news-list/index?newstypeid=' + id,
      })
    }
    else if (linktype == "page" && id == 1) {//优惠劵
      wx.navigateTo({
        url: url
      })
    }
    else if (linktype == "page" && id == 2) {//关于
      wx.setStorageSync("tap", 0);
      wx.reLaunch({
        url: url
      })
    }
    else if (linktype == "page" && id == 3) {//在线客服
      wx.navigateTo({
        url: url
      })
    }
    else if (linktype == "page" && id == 4) {//申请分销
      wx.navigateTo({
        url: url
      })
    }
    else if (linktype == "page" && id == 5) {//预约留言
      wx.navigateTo({
        url: url
      })
    }
    else if (linktype == "page" && id == 6) {//联系方式
      wx.setStorageSync("tap", 1);
      wx.reLaunch({
        url: url
      })
    }
    else if (linktype == "page" && id == 7) {//一键导航
      wx.setStorageSync("tap", 2);
      wx.reLaunch({
        url: url
      })
    }
    else if (linktype == "page" && id == 8) {//拼团
      wx.navigateTo({
        url: url
      })
    }
    else if (linktype == "page" && id == 9) {//限时秒杀
      wx.navigateTo({
        url: url
      })
    }
    else if (linktype == "page" && id == 10) {//留言管理
      wx.navigateTo({
        url: url
      })
    }
    else if (linktype == "page" && id == 11) {//所有商品
      wx.navigateTo({
        url: url
      })
    }
    else if (linktype == "page" && id == 13) {//附近门店
      wx.navigateTo({
        url: url
      })
    }
    else {
      wx.navigateTo({
        url: url
      })
    }
  }
  else if (id == 0 && linktype == "h5page") {//h5网页
    wx.navigateTo({
      url: '/pages/h5page/index?url=' + url,
    })
  }
  else if (id == 0 && linktype == "phonecall") {//一键拨号
    wx.makePhoneCall({
      phoneNumber: mobile
    })
  } else if (id == 0 && linktype == "weappfunc") {//客服会话
    this.setData({
      contact: true
    })
  }
  else {
    wx.navigateTo({
      url: url
    })
  }
}
module.exports = {
  tapBanner: tapBanner
}